package cn.com.wangluotongxin.admin.model.constants;

public enum MessageType {
    // 消息类型 0.系统 1.用户
    SYS(0, "系统"),
    USER(1, "用户");

    private Integer code;
    public Integer getCode(){
        return this.code;
    }

    private String name;
    public String getName(){
        return this.name;
    }

    public static MessageType getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            MessageType[] messageTypes = values();
            for(MessageType messageType : messageTypes){
                if(messageType.getCode().equals(code)){
                    return messageType;
                }
            }
        }
        return null;
    }

    MessageType(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
